package heap;

/**
 * 用堆实现优先队列
 * @param <E> 添加元素类型
 */
public class PriorityQueue<E extends Comparable<E>> {

    private MaxHeap<E> maxHeap;

    public PriorityQueue(){
        maxHeap = new MaxHeap<>();
    }

    public int getSize(){
        return maxHeap.getSize();
    }

    public boolean isEmpty(){
        return maxHeap.getSize() == 0;
    }

    public void enqueue(E e){
        maxHeap.add(e);
    }

    public E dequeue(){
        return maxHeap.extractMax();
    }



}
